package com.xoa.controller.dutypoliceusers;

import com.xoa.model.dutypoliceusers.DutyPoliceUsers;
import com.xoa.service.dutypoliceusers.DutyPoliceUsersService;
import com.xoa.util.ToJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;

@Controller
@RequestMapping("DutyPoliceUsers")
public class DutyPoliceUsersController {



    @Autowired
    private DutyPoliceUsersService dutyPoliceUsersService;

    /**
     *  值班安排查询
     */
    @RequestMapping("/queryDuty")
    public String queryDuty(HttpServletRequest request){
        return "app/dutypoliceusers/queryDuty";
    }

    //映射页面移动端
    @RequestMapping("/dutypoliceusersapp")
    public String dutypoliceusersapp(){
        return "app/ewx/dutypoliceusers/dutypoliceusersapp";
    }
    //映射页面移动端
    @RequestMapping("/dutyDetails")
    public String dutyDetails(){
        return "app/ewx/dutypoliceusers/dutyDetails";
    }

    /**
     * @Author 廉立深
     * @Description 条件查询
     * @Date 15:22 2020/5/21
     * @Param []
     * @return com.xoa.util.ToJson
     **/
    @RequestMapping("/findDutyPoliceWhere")
    @ResponseBody
    public ToJson findDutyPoliceWhere(HttpServletRequest request , DutyPoliceUsers dutyPoliceUsers,Integer page ,Integer limit){
        return  dutyPoliceUsersService.findDutyPoliceWhere(request,dutyPoliceUsers,page,limit);
    }

    /**
     * @Author 廉立深
     * @Description 根据ID查询
     * @Date 15:27 2020/5/21
     * @Param [request, dutyPoliceUsers]
     * @return com.xoa.util.ToJson
     **/
    @RequestMapping("/findDutyPoliceById")
    @ResponseBody
    public ToJson findDutyPoliceById(HttpServletRequest request , DutyPoliceUsers dutyPoliceUsers){
        return  dutyPoliceUsersService.findDutyPoliceById(request,dutyPoliceUsers);
    }

    /**
     * @Author 廉立深
     * @Description 编辑和新增
     * @Date 15:27 2020/5/21
     * @Param [request, dutyPoliceUsers]
     * @return com.xoa.util.ToJson
     **/
    @RequestMapping("/editOrInsertDuty")
    @ResponseBody
    public ToJson editOrInsertDuty(HttpServletRequest request , DutyPoliceUsers dutyPoliceUsers){
        return  dutyPoliceUsersService.editOrInsertDuty(request,dutyPoliceUsers);
    }

    /**
     * @Author 廉立深
     * @Description 删除接口
     * @Date 15:27 2020/5/21
     * @Param [request, dutyIds]
     * @return com.xoa.util.ToJson
     **/
    @RequestMapping("/deleteDuty")
    @ResponseBody
    public ToJson deleteDuty(HttpServletRequest request , @RequestParam("dutyIds") String dutyIds){
        return  dutyPoliceUsersService.deleteDuty(request,dutyIds);
    }


    /**
     * @Author 廉立深
     * @Description 导入excel，公安局的
     * @Date 10:14 2020/5/22
     * @Param [request, dutyPoliceUsers]
     * @return com.xoa.util.ToJson
     **/
    @RequestMapping("/ImportDutyPolice")
    @ResponseBody
    public ToJson ImportDutyPolice(HttpServletRequest request , @RequestParam("file") MultipartFile multipartFile){
        return  dutyPoliceUsersService.ImportDutyPolice(request,multipartFile);
    }

}
